{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:14.564249Z",
     "start_time": "2024-03-06T09:35:14.550055Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import pickle"
   ]
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "sp = pd.read_csv(\"E:/baselines/ZZ500.csv\")\n",
    "# sp = sp.drop(columns=['prev_close' ,'adjfactor'])\n",
    "sp['dt'] = pd.to_datetime(sp['dt'])"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:14.732876Z",
     "start_time": "2024-03-06T09:35:14.566514Z"
    }
   },
   "id": "b06c766b1f5d3fec",
   "execution_count": 17
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "grouped_df = sp.groupby('kdcode')\n",
    "l = sp['dt'].nunique()\n",
    "\n",
    "def filter_groups(group):\n",
    "    return len(group) == l\n",
    "\n",
    "df = grouped_df.filter(filter_groups)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:14.779781Z",
     "start_time": "2024-03-06T09:35:14.733878Z"
    }
   },
   "id": "d26c149ec7acba35",
   "execution_count": 18
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "116"
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['kdcode'].nunique()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:14.795259Z",
     "start_time": "2024-03-06T09:35:14.781781Z"
    }
   },
   "id": "93a307ddf8ebf26c",
   "execution_count": 19
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "df['label'] = df.groupby('kdcode')['close'].pct_change()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:14.842580Z",
     "start_time": "2024-03-06T09:35:14.796728Z"
    }
   },
   "id": "e189b1d126fe80",
   "execution_count": 20
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "           kdcode         dt  close   open   high    low     turnover  \\\n0       000009.SZ 2018-01-02   7.32   7.27   7.33   7.23  140497530.0   \n1       000009.SZ 2018-01-03   7.42   7.32   7.44   7.30  170636551.0   \n2       000009.SZ 2018-01-04   7.64   7.52   7.70   7.51  358089946.0   \n3       000009.SZ 2018-01-05   7.55   7.65   7.65   7.51  196259451.0   \n4       000009.SZ 2018-01-08   7.52   7.55   7.63   7.46  178511079.0   \n...           ...        ...    ...    ...    ...    ...          ...   \n169007  603883.SH 2023-12-25  29.37  29.02  29.58  28.80  101007153.0   \n169008  603883.SH 2023-12-26  29.05  29.26  29.49  28.82   66158144.0   \n169009  603883.SH 2023-12-27  30.08  28.94  30.40  28.80  206474442.0   \n169010  603883.SH 2023-12-28  28.98  30.15  30.20  28.44  264520627.0   \n169011  603883.SH 2023-12-29  29.89  28.97  30.00  28.80  204020452.0   \n\n            volume     label  \n0       19269993.0  0.000000  \n1       23092097.0  0.013661  \n2       46992707.0  0.029650  \n3       25990264.0 -0.011780  \n4       23703431.0 -0.003974  \n...            ...       ...  \n169007   3457490.0  0.012061  \n169008   2272587.0 -0.010895  \n169009   6939076.0  0.035456  \n169010   9053474.0 -0.036569  \n169011   6878338.0  0.031401  \n\n[169012 rows x 9 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>kdcode</th>\n      <th>dt</th>\n      <th>close</th>\n      <th>open</th>\n      <th>high</th>\n      <th>low</th>\n      <th>turnover</th>\n      <th>volume</th>\n      <th>label</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>000009.SZ</td>\n      <td>2018-01-02</td>\n      <td>7.32</td>\n      <td>7.27</td>\n      <td>7.33</td>\n      <td>7.23</td>\n      <td>140497530.0</td>\n      <td>19269993.0</td>\n      <td>0.000000</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>000009.SZ</td>\n      <td>2018-01-03</td>\n      <td>7.42</td>\n      <td>7.32</td>\n      <td>7.44</td>\n      <td>7.30</td>\n      <td>170636551.0</td>\n      <td>23092097.0</td>\n      <td>0.013661</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>000009.SZ</td>\n      <td>2018-01-04</td>\n      <td>7.64</td>\n      <td>7.52</td>\n      <td>7.70</td>\n      <td>7.51</td>\n      <td>358089946.0</td>\n      <td>46992707.0</td>\n      <td>0.029650</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>000009.SZ</td>\n      <td>2018-01-05</td>\n      <td>7.55</td>\n      <td>7.65</td>\n      <td>7.65</td>\n      <td>7.51</td>\n      <td>196259451.0</td>\n      <td>25990264.0</td>\n      <td>-0.011780</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>000009.SZ</td>\n      <td>2018-01-08</td>\n      <td>7.52</td>\n      <td>7.55</td>\n      <td>7.63</td>\n      <td>7.46</td>\n      <td>178511079.0</td>\n      <td>23703431.0</td>\n      <td>-0.003974</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>169007</th>\n      <td>603883.SH</td>\n      <td>2023-12-25</td>\n      <td>29.37</td>\n      <td>29.02</td>\n      <td>29.58</td>\n      <td>28.80</td>\n      <td>101007153.0</td>\n      <td>3457490.0</td>\n      <td>0.012061</td>\n    </tr>\n    <tr>\n      <th>169008</th>\n      <td>603883.SH</td>\n      <td>2023-12-26</td>\n      <td>29.05</td>\n      <td>29.26</td>\n      <td>29.49</td>\n      <td>28.82</td>\n      <td>66158144.0</td>\n      <td>2272587.0</td>\n      <td>-0.010895</td>\n    </tr>\n    <tr>\n      <th>169009</th>\n      <td>603883.SH</td>\n      <td>2023-12-27</td>\n      <td>30.08</td>\n      <td>28.94</td>\n      <td>30.40</td>\n      <td>28.80</td>\n      <td>206474442.0</td>\n      <td>6939076.0</td>\n      <td>0.035456</td>\n    </tr>\n    <tr>\n      <th>169010</th>\n      <td>603883.SH</td>\n      <td>2023-12-28</td>\n      <td>28.98</td>\n      <td>30.15</td>\n      <td>30.20</td>\n      <td>28.44</td>\n      <td>264520627.0</td>\n      <td>9053474.0</td>\n      <td>-0.036569</td>\n    </tr>\n    <tr>\n      <th>169011</th>\n      <td>603883.SH</td>\n      <td>2023-12-29</td>\n      <td>29.89</td>\n      <td>28.97</td>\n      <td>30.00</td>\n      <td>28.80</td>\n      <td>204020452.0</td>\n      <td>6878338.0</td>\n      <td>0.031401</td>\n    </tr>\n  </tbody>\n</table>\n<p>169012 rows × 9 columns</p>\n</div>"
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['label'] = df['label'].fillna(0)\n",
    "df"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:14.857856Z",
     "start_time": "2024-03-06T09:35:14.843744Z"
    }
   },
   "id": "a4a7e3b83cfb393c",
   "execution_count": 21
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "# 先创建一个空的 MultiIndex\n",
    "index = pd.MultiIndex(levels=[[], []], codes=[[], []], names=['dt', 'kdcode'])\n",
    "\n",
    "# 遍历每个公司，为每个日期添加公司，并更新 MultiIndex\n",
    "for company in df['kdcode'].unique():\n",
    "    # 为每个公司创建一个临时 MultiIndex\n",
    "    temp_index = pd.MultiIndex.from_product([[date for date in df['dt'].unique()], [company]], names=['dt', 'kdcode'])\n",
    "    # 更新 MultiIndex\n",
    "    index = index.union(temp_index)\n",
    "myData = pd.DataFrame(df[['close', 'high', 'low', 'open', 'volume', 'turnover']].values, index=index, columns=['close', 'high', 'low', 'open', 'volume', 'turnover'])"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:16.708937Z",
     "start_time": "2024-03-06T09:35:14.858986Z"
    }
   },
   "id": "80afbdd8ca4f769d",
   "execution_count": 22
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "                      close   high    low   open      volume     turnover\ndt         kdcode                                                        \n2018-01-02 000009.SZ   7.32   7.33   7.23   7.27  19269993.0  140497530.0\n           000021.SZ   7.42   7.44   7.30   7.32  23092097.0  170636551.0\n           000027.SZ   7.64   7.70   7.51   7.52  46992707.0  358089946.0\n           000031.SZ   7.55   7.65   7.51   7.65  25990264.0  196259451.0\n           000039.SZ   7.52   7.63   7.46   7.55  23703431.0  178511079.0\n...                     ...    ...    ...    ...         ...          ...\n2023-12-29 603355.SH  29.37  29.58  28.80  29.02   3457490.0  101007153.0\n           603444.SH  29.05  29.49  28.82  29.26   2272587.0   66158144.0\n           603568.SH  30.08  30.40  28.80  28.94   6939076.0  206474442.0\n           603868.SH  28.98  30.20  28.44  30.15   9053474.0  264520627.0\n           603883.SH  29.89  30.00  28.80  28.97   6878338.0  204020452.0\n\n[169012 rows x 6 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th></th>\n      <th>close</th>\n      <th>high</th>\n      <th>low</th>\n      <th>open</th>\n      <th>volume</th>\n      <th>turnover</th>\n    </tr>\n    <tr>\n      <th>dt</th>\n      <th>kdcode</th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th rowspan=\"5\" valign=\"top\">2018-01-02</th>\n      <th>000009.SZ</th>\n      <td>7.32</td>\n      <td>7.33</td>\n      <td>7.23</td>\n      <td>7.27</td>\n      <td>19269993.0</td>\n      <td>140497530.0</td>\n    </tr>\n    <tr>\n      <th>000021.SZ</th>\n      <td>7.42</td>\n      <td>7.44</td>\n      <td>7.30</td>\n      <td>7.32</td>\n      <td>23092097.0</td>\n      <td>170636551.0</td>\n    </tr>\n    <tr>\n      <th>000027.SZ</th>\n      <td>7.64</td>\n      <td>7.70</td>\n      <td>7.51</td>\n      <td>7.52</td>\n      <td>46992707.0</td>\n      <td>358089946.0</td>\n    </tr>\n    <tr>\n      <th>000031.SZ</th>\n      <td>7.55</td>\n      <td>7.65</td>\n      <td>7.51</td>\n      <td>7.65</td>\n      <td>25990264.0</td>\n      <td>196259451.0</td>\n    </tr>\n    <tr>\n      <th>000039.SZ</th>\n      <td>7.52</td>\n      <td>7.63</td>\n      <td>7.46</td>\n      <td>7.55</td>\n      <td>23703431.0</td>\n      <td>178511079.0</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th rowspan=\"5\" valign=\"top\">2023-12-29</th>\n      <th>603355.SH</th>\n      <td>29.37</td>\n      <td>29.58</td>\n      <td>28.80</td>\n      <td>29.02</td>\n      <td>3457490.0</td>\n      <td>101007153.0</td>\n    </tr>\n    <tr>\n      <th>603444.SH</th>\n      <td>29.05</td>\n      <td>29.49</td>\n      <td>28.82</td>\n      <td>29.26</td>\n      <td>2272587.0</td>\n      <td>66158144.0</td>\n    </tr>\n    <tr>\n      <th>603568.SH</th>\n      <td>30.08</td>\n      <td>30.40</td>\n      <td>28.80</td>\n      <td>28.94</td>\n      <td>6939076.0</td>\n      <td>206474442.0</td>\n    </tr>\n    <tr>\n      <th>603868.SH</th>\n      <td>28.98</td>\n      <td>30.20</td>\n      <td>28.44</td>\n      <td>30.15</td>\n      <td>9053474.0</td>\n      <td>264520627.0</td>\n    </tr>\n    <tr>\n      <th>603883.SH</th>\n      <td>29.89</td>\n      <td>30.00</td>\n      <td>28.80</td>\n      <td>28.97</td>\n      <td>6878338.0</td>\n      <td>204020452.0</td>\n    </tr>\n  </tbody>\n</table>\n<p>169012 rows × 6 columns</p>\n</div>"
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "myData"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:16.724848Z",
     "start_time": "2024-03-06T09:35:16.710059Z"
    }
   },
   "id": "41f4808b275570f3",
   "execution_count": 23
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "from sklearn.preprocessing import MinMaxScaler\n",
    "scaler = MinMaxScaler()\n",
    "\n",
    "scaled_data = scaler.fit_transform(myData)\n",
    "scaled_myData = pd.DataFrame(scaled_data, index=myData.index, columns=myData.columns)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:16.755878Z",
     "start_time": "2024-03-06T09:35:16.726121Z"
    }
   },
   "id": "e03e34a2538678ea",
   "execution_count": 24
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "                         close      high       low      open    volume  \\\ndt         kdcode                                                        \n2018-01-02 000009.SZ  0.009366  0.010914  0.011568  0.011100  0.014217   \n           000021.SZ  0.009519  0.011078  0.011680  0.011176  0.017037   \n           000027.SZ  0.009856  0.011465  0.012016  0.011482  0.034671   \n           000031.SZ  0.009718  0.011391  0.012016  0.011680  0.019175   \n           000039.SZ  0.009672  0.011361  0.011936  0.011528  0.017488   \n...                        ...       ...       ...       ...       ...   \n2023-12-29 603355.SH  0.043164  0.044044  0.046079  0.044309  0.002551   \n           603444.SH  0.042674  0.043910  0.046111  0.044675  0.001677   \n           603568.SH  0.044253  0.045265  0.046079  0.044187  0.005120   \n           603868.SH  0.042567  0.044967  0.045503  0.046034  0.006680   \n           603883.SH  0.043961  0.044669  0.046079  0.044232  0.005075   \n\n                      turnover  \ndt         kdcode               \n2018-01-02 000009.SZ  0.012905  \n           000021.SZ  0.015673  \n           000027.SZ  0.032890  \n           000031.SZ  0.018026  \n           000039.SZ  0.016396  \n...                        ...  \n2023-12-29 603355.SH  0.009277  \n           603444.SH  0.006077  \n           603568.SH  0.018964  \n           603868.SH  0.024296  \n           603883.SH  0.018739  \n\n[169012 rows x 6 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th></th>\n      <th>close</th>\n      <th>high</th>\n      <th>low</th>\n      <th>open</th>\n      <th>volume</th>\n      <th>turnover</th>\n    </tr>\n    <tr>\n      <th>dt</th>\n      <th>kdcode</th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th rowspan=\"5\" valign=\"top\">2018-01-02</th>\n      <th>000009.SZ</th>\n      <td>0.009366</td>\n      <td>0.010914</td>\n      <td>0.011568</td>\n      <td>0.011100</td>\n      <td>0.014217</td>\n      <td>0.012905</td>\n    </tr>\n    <tr>\n      <th>000021.SZ</th>\n      <td>0.009519</td>\n      <td>0.011078</td>\n      <td>0.011680</td>\n      <td>0.011176</td>\n      <td>0.017037</td>\n      <td>0.015673</td>\n    </tr>\n    <tr>\n      <th>000027.SZ</th>\n      <td>0.009856</td>\n      <td>0.011465</td>\n      <td>0.012016</td>\n      <td>0.011482</td>\n      <td>0.034671</td>\n      <td>0.032890</td>\n    </tr>\n    <tr>\n      <th>000031.SZ</th>\n      <td>0.009718</td>\n      <td>0.011391</td>\n      <td>0.012016</td>\n      <td>0.011680</td>\n      <td>0.019175</td>\n      <td>0.018026</td>\n    </tr>\n    <tr>\n      <th>000039.SZ</th>\n      <td>0.009672</td>\n      <td>0.011361</td>\n      <td>0.011936</td>\n      <td>0.011528</td>\n      <td>0.017488</td>\n      <td>0.016396</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th rowspan=\"5\" valign=\"top\">2023-12-29</th>\n      <th>603355.SH</th>\n      <td>0.043164</td>\n      <td>0.044044</td>\n      <td>0.046079</td>\n      <td>0.044309</td>\n      <td>0.002551</td>\n      <td>0.009277</td>\n    </tr>\n    <tr>\n      <th>603444.SH</th>\n      <td>0.042674</td>\n      <td>0.043910</td>\n      <td>0.046111</td>\n      <td>0.044675</td>\n      <td>0.001677</td>\n      <td>0.006077</td>\n    </tr>\n    <tr>\n      <th>603568.SH</th>\n      <td>0.044253</td>\n      <td>0.045265</td>\n      <td>0.046079</td>\n      <td>0.044187</td>\n      <td>0.005120</td>\n      <td>0.018964</td>\n    </tr>\n    <tr>\n      <th>603868.SH</th>\n      <td>0.042567</td>\n      <td>0.044967</td>\n      <td>0.045503</td>\n      <td>0.046034</td>\n      <td>0.006680</td>\n      <td>0.024296</td>\n    </tr>\n    <tr>\n      <th>603883.SH</th>\n      <td>0.043961</td>\n      <td>0.044669</td>\n      <td>0.046079</td>\n      <td>0.044232</td>\n      <td>0.005075</td>\n      <td>0.018739</td>\n    </tr>\n  </tbody>\n</table>\n<p>169012 rows × 6 columns</p>\n</div>"
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "scaled_myData"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:16.771340Z",
     "start_time": "2024-03-06T09:35:16.756878Z"
    }
   },
   "id": "ea4bf9d752472a48",
   "execution_count": 25
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "scaled_myData.to_pickle('zzfea.pkl')"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:16.801888Z",
     "start_time": "2024-03-06T09:35:16.772432Z"
    }
   },
   "id": "c5443109af390cb2",
   "execution_count": 26
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "labData = pd.DataFrame(df[['label']].values, index=index, columns=['label'])\n",
    "labData_filled = labData.fillna(0)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:16.817394Z",
     "start_time": "2024-03-06T09:35:16.803066Z"
    }
   },
   "id": "c02916431e9307da",
   "execution_count": 27
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "                         label\ndt         kdcode             \n2018-01-02 000009.SZ  0.000000\n           000021.SZ  0.013661\n           000027.SZ  0.029650\n           000031.SZ -0.011780\n           000039.SZ -0.003974\n...                        ...\n2023-12-29 603355.SH  0.012061\n           603444.SH -0.010895\n           603568.SH  0.035456\n           603868.SH -0.036569\n           603883.SH  0.031401\n\n[169012 rows x 1 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th></th>\n      <th>label</th>\n    </tr>\n    <tr>\n      <th>dt</th>\n      <th>kdcode</th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th rowspan=\"5\" valign=\"top\">2018-01-02</th>\n      <th>000009.SZ</th>\n      <td>0.000000</td>\n    </tr>\n    <tr>\n      <th>000021.SZ</th>\n      <td>0.013661</td>\n    </tr>\n    <tr>\n      <th>000027.SZ</th>\n      <td>0.029650</td>\n    </tr>\n    <tr>\n      <th>000031.SZ</th>\n      <td>-0.011780</td>\n    </tr>\n    <tr>\n      <th>000039.SZ</th>\n      <td>-0.003974</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <th>...</th>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th rowspan=\"5\" valign=\"top\">2023-12-29</th>\n      <th>603355.SH</th>\n      <td>0.012061</td>\n    </tr>\n    <tr>\n      <th>603444.SH</th>\n      <td>-0.010895</td>\n    </tr>\n    <tr>\n      <th>603568.SH</th>\n      <td>0.035456</td>\n    </tr>\n    <tr>\n      <th>603868.SH</th>\n      <td>-0.036569</td>\n    </tr>\n    <tr>\n      <th>603883.SH</th>\n      <td>0.031401</td>\n    </tr>\n  </tbody>\n</table>\n<p>169012 rows × 1 columns</p>\n</div>"
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "labData_filled"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:16.832652Z",
     "start_time": "2024-03-06T09:35:16.819794Z"
    }
   },
   "id": "ee4ebb76b87da0d1",
   "execution_count": 28
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "labData_filled.to_pickle('zzlab.pkl')"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-06T09:35:16.848560Z",
     "start_time": "2024-03-06T09:35:16.834865Z"
    }
   },
   "id": "53ea3389d87c507f",
   "execution_count": 29
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
